package it.com;

import java.util.Random;

public class LogicalOperation {
    public static void main(String[] args) {
        int age = 40;
        //判断age是否在18-50之间
        boolean b1 = age >= 18 && age <= 50;
        System.out.println("b1 = " + b1);

        int score = 100;
        //判断score是否在0-100之间
        boolean b2 = score >= 0 && score <= 100;
        System.out.println("b2 = " + b2);


        int num = 1001;
        //判断数字是否合法(不在0-1000以内)
        boolean b3 = num < 0 || num > 1000;
        System.out.println("b3 = " + b3);

        boolean b4 = !(num <= 0 && num >= 1000);
        System.out.println("b4 = " + b4);

        System.out.println("---------------------");

        //指定随机数范围
        Random random = new Random();
        //这里的bound参数是指[0,100)范围，包括0，不包括100
        int num1 = random.nextInt(100);
        System.out.println(num1);

        //如果想随机1-100，那么就是
        int num2 = random.nextInt(100)+1;
        System.out.println("num2 = " + num2);

        //随机100-1000
        int num3 = random.nextInt(900)+100;
        System.out.println("num3 = " + num3);
    }
}
